<template>
  <div>
    <div class="control-strategy-page">
      <div class="content container">
        <div class="head-section">
          <h3 class="table-head">所属网点：</h3>
          <el-select
            v-model="organId"
            @change="organChangeEvent"
            placeholder="请选择所属网点"
          >
            <el-option
              v-for="item in organOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
          <el-button
            type="primary"
            @click="dialogAddSceneVisible = true"
            plain
            style="margin-left: 0.1rem"
            >添加场景</el-button
          >
        </div>
        <div class="scene-section-row">
          <el-scrollbar wrap-class="scrollbar-wrapper" style="height: 100%">
            <div class="scene-section-list">
              <div
                v-for="(item, index) of Scene_data"
                :key="item.id"
                class="scene-section-box"
              >
                <div
                  class="sceneRecord"
                  @click="getSceneLinkageRecord(item.id, item.sceneName)"
                >
                  <i class="el-icon-document"></i>
                </div>
                <div>
                  <span>场景名称：</span>
                  <p class="sceneName" :title="item.sceneName">
                    {{ item.sceneName }}
                  </p>
                  <i
                    @click="editSceneName(item, index)"
                    class="el-icon-edit-outline"
                  ></i>
                </div>
                <div>
                  <span>触发条件：</span>
                  <p>{{ item.conditionprod }}</p>
                </div>
                <div>
                  <span>是否启用：</span>
                  <p>
                    <el-switch
                      @change="editSceneEnabled($event, item, 1)"
                      style="display: block"
                      v-model="item.enabled"
                      :active-value="1"
                      :inactive-value="0"
                      active-color="#13ce66"
                      inactive-color="#ff4949"
                      active-text="启用"
                      inactive-text="停用"
                    >
                    </el-switch>
                  </p>
                </div>
                <div>
                  <span>联动设备数：</span>
                  <p>{{ item.tasknum }}</p>
                </div>
                <div class="scene-section-btn-group">
                  <!-- <el-button type="danger" @click="handlebindScene(item.id)"
                    >测试</el-button
                  > -->
                  <div @click="handleDeleteScene(item.id)">
                    <img src="@/assets/icons/delete_Scene_icon.png" />
                    <span>删除场景</span>
                  </div>
                  <div @click="handleSceneTrigger(item.id)">
                    <img src="@/assets/icons/target_Scene_icon.png" />
                    <span>触发设备</span>
                  </div>

                  <div @click="handleSceneTarget(item.id)">
                    <img src="@/assets/icons/trigger_Scene_icon.png" />
                    <span>目标设备</span>
                  </div>
                </div>
              </div>
            </div>
          </el-scrollbar>
        </div>
      </div>
    </div>
    <div>
      <el-dialog
        :title="studyTitle"
        :visible.sync="dialogAddSceneVisible"
        :width="studyWidth"
        class="AddScene-row"
        @close="closeAddScene"
        :close-on-click-modal="false"
      >
        <div v-show="steps == 1 || steps == 6">
          <el-form
            :model="AddScene"
            :rules="Scenerulesname"
            ref="addSceneForm"
            label-width="100px"
          >
            <el-form-item label="场景名称" prop="sceneName">
              <el-input
                v-model.trim="AddScene.sceneName"
                placeholder="请填写场景名称"
              ></el-input>
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer" style="text-align: center">
            <el-button
              v-if="steps == 6"
              type="primary"
              @click="editSceneEnabled('', '', 0)"
              >确定</el-button
            >
            <el-button
              v-if="steps == 1"
              type="primary"
              @click="nextStep('addSceneForm')"
              >下一步</el-button
            >
            <el-button @click="dialogAddSceneVisible = false">取 消</el-button>
          </div>
        </div>
        <div v-show="steps == 2 || steps == 4 || steps == 5">
          <div style="display: flex">
            <el-form
              :rules="triggerprodScenerules"
              :model="AddScene"
              ref="triggerprodScene"
              label-width="100px"
              style="width: 500px; min-width: 500px"
            >
              <el-form-item
                label="设备组"
                prop="triggergroupId"
                v-if="steps == 2"
              >
                <el-select
                  v-model="AddScene.triggergroupId"
                  filterable
                  placeholder="请选择触发设备组"
                  @change="triggergroupchange(1)"
                >
                  <el-option
                    v-for="item of SceneGrouplist"
                    :key="item.id"
                    :label="item.sceneGroupName"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="触发设备"
                prop="triggerprodId"
                v-if="steps == 2"
              >
                <el-select
                  v-model="AddScene.triggerprodId"
                  multiple
                  collapse-tags
                  placeholder="请选择触发设备"
                  @remove-tag="triggerprodremovechange()"
                  @visible-change="triggerprodvisiblechange($event)"
                >
                  <el-option
                    v-for="item of triggerprodData"
                    :key="item.id"
                    :label="item.channelName"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="触发设备"
                prop="triggerprodId"
                v-if="steps == 4"
              >
                <el-select
                  v-model="AddScene.triggerprodId"
                  placeholder="请选择触发设备"
                  @change="triggerprodchange()"
                >
                  <el-option
                    v-for="item of triggerprodData"
                    :key="item.id"
                    :label="item.channelName"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <div
                class="el-form-item"
                v-if="AddScene.sceneActionList.length > 0"
              >
                <div class="el-form-item__label" style="width: 100px">
                  触发设备
                </div>
                <el-tabs
                  v-model="AddScene.sceneindex"
                  class="triggerprod_tab_row"
                >
                  <el-tab-pane
                    :key="item.channelId"
                    v-for="item of AddScene.sceneActionList"
                    :label="item.channelName"
                    :name="item.channelId + ''"
                  >
                    <div
                      slot="label"
                      :class="item.isExistTrigger ? 'ActionExistTrigger' : ''"
                    >
                      {{ item.channelName
                      }}<i
                        @click.stop="delisExistTrigger(item.channelId)"
                        v-if="item.isExistTrigger && steps != 4"
                        class="el-icon-error"
                      ></i>
                    </div>
                    <div v-if="item.isExistTrigger">
                      <div class="isExistTriggertitle">
                        在以下场景做作为目标设备存在
                      </div>
                      <div class="isExistTriggerlistrow">
                        <div
                          v-for="item of item.existTriggerList"
                          :key="item.id"
                        >
                          {{ item.sceneName }}
                        </div>
                      </div>
                    </div>
                    <el-form-item
                      label="触发要求"
                      v-if="
                        AddScene.sceneActionList.length > 1 ||
                        dialogEditTriggerVisible
                      "
                    >
                      <el-radio-group v-model="item.singleton">
                        <el-radio :label="1">单条件满足</el-radio>
                        <el-radio :label="0">多条件满足</el-radio>
                      </el-radio-group>
                    </el-form-item>
                    <div
                      v-if="
                        item.MoldCodeindex != 0 &&
                        item.MoldCodeindex != 4 &&
                        item.MoldCodeindex != 5
                      "
                    >
                      <el-form-item label="触发属性">
                        <el-radio-group
                          v-model="item.triggerAttr"
                          @change="triggerAttrchange(item)"
                        >
                          <el-radio
                            :key="item.id"
                            :label="item.id"
                            v-for="item of gettriggerAttr_Options(
                              item.probeType
                            )"
                            >{{ item.name }}</el-radio
                          >
                        </el-radio-group>
                      </el-form-item>
                      <el-form-item
                        class="form-triggerAttr"
                        label="触发条件"
                        v-if="
                          item.triggerAttr != 4 &&
                          item.triggerAttr != 8 &&
                          item.triggerAttr != null
                        "
                      >
                        <el-radio-group v-model="item.triggerCondition">
                          <el-radio
                            :key="item.id"
                            :label="item.id"
                            v-for="item of triggerCondition_Options"
                            >{{ item.name }}</el-radio
                          >
                        </el-radio-group>
                        <el-input
                          v-if="
                            item.triggerAttr != 4 &&
                            item.triggerAttr != 6 &&
                            item.triggerAttr != 7
                          "
                          class="triggercondition-input"
                          v-model.number="item.triggerValue"
                          placeholder="请填写触发值"
                        ></el-input>
                        <el-input-number
                          :min="16"
                          :max="30"
                          :step="1"
                          v-if="
                            item.triggerAttr != 4 &&
                            (item.triggerAttr == 6 || item.triggerAttr == 7)
                          "
                          class="triggercondition-input"
                          v-model.number="item.triggerValue"
                          placeholder="请填写触发值"
                        ></el-input-number>
                      </el-form-item>
                    </div>
                    <div
                      v-if="item.MoldCodeindex == 0 || item.triggerAttr == 4"
                    >
                      <el-form-item label="触发条件">
                        <el-switch
                          v-model="item.triggerValue"
                          active-color="#13ce66"
                          inactive-color="#ff4949"
                          :active-value="1"
                          active-text="设备开"
                          :inactive-value="0"
                          inactive-text="设备关"
                        >
                        </el-switch>
                      </el-form-item>
                    </div>
                    <div v-if="item.MoldCodeindex == 4">
                      <el-form-item label="红外检测">
                        <el-radio-group v-model="item.triggerValue">
                          <el-radio :label="48">有人</el-radio>
                          <el-radio :label="49">无人</el-radio>
                        </el-radio-group>
                      </el-form-item>
                    </div>
                  </el-tab-pane>
                </el-tabs>
              </div>
              <!-- 
            <el-form-item
              v-if="AddScene.triggerprodaction == 3"
              label="停留时间"
              prop="triggerprodtime"
              class="triggercondition-input"
            >
              <el-input
                v-model.number="AddScene.triggerprodtime"
                placeholder="请填写停留时间"
              ></el-input>
              <span>分钟</span>
            </el-form-item>
            <el-form-item
              v-if="AddScene.triggerprodaction == 4"
              label="走动次数"
              prop="triggerprodnum"
              class="triggercondition-input"
            >
              <el-input
                v-model.number="AddScene.triggerprodnum"
                placeholder="请填写走动次数"
              ></el-input>
              <span>次</span>
            </el-form-item> -->
            </el-form>
            <div class="factorprod-row" v-if="steps == 2">
              <div class="factorprod-box" style="margin-bottom: 0.1rem">
                <div class="factorprod" @click="singshow = !singshow">
                  <span>单条件满足触发</span
                  ><i
                    :class="
                      singshow ? 'el-icon-arrow-down' : 'el-icon-arrow-up'
                    "
                  ></i>
                </div>
                <div
                  class="sing-pro"
                  :style="
                    singshow
                      ? mulshow
                        ? ''
                        : 'height:2.2rem'
                      : 'height:0;margin:0'
                  "
                >
                  <div
                    @click="AddScene.sceneindex = item.channelId + ''"
                    v-for="(item, index) of getSinglrOrMultiplefactorlist(
                      AddScene.sceneActionList,
                      1
                    )"
                    :key="index"
                  >
                    {{ item.channelName }}
                  </div>
                </div>
              </div>
              <div class="factorprod-box">
                <div class="factorprod" @click="mulshow = !mulshow">
                  <span>多条件满足触发</span
                  ><i
                    :class="mulshow ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
                  ></i>
                </div>
                <div
                  class="mul-pro"
                  :style="
                    mulshow
                      ? singshow
                        ? ''
                        : 'height:2.2rem'
                      : 'height:0;margin:0'
                  "
                >
                  <div
                    @click="AddScene.sceneindex = item.channelId + ''"
                    v-for="(item, index) of getSinglrOrMultiplefactorlist(
                      AddScene.sceneActionList,
                      0
                    )"
                    :key="index"
                  >
                    {{ item.channelName }}
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="dialog-footer" style="text-align: center">
            <el-button
              type="primary"
              v-if="this.steps == 4 || this.steps == 5"
              @click="addoreditSceneTrigger('triggerprodScene')"
              >确定提交</el-button
            >
            <el-button
              type="primary"
              v-if="this.steps == 2"
              @click="nextStep('triggerprodScene')"
              >下一步</el-button
            >
            <el-button @click="dialogAddSceneVisible = false">取 消</el-button>
          </div>
        </div>
        <div v-show="steps == 3">
          <div>
            <el-button type="primary" plain @click="handleAddTaskprod()"
              >添加目标设备</el-button
            >
          </div>
          <div>
            <el-table
              :data="AddScene.sceneActionDetailList"
              style="width: 100%"
              ref="multipleTable"
            >
              <el-table-column prop="channelName" label="通道名称">
              </el-table-column>
              <el-table-column prop="open" label="开关操作" align="center">
                <template slot-scope="scope">
                  <div class="open-row">
                    <span style="margin-right: 0.1rem">
                      {{ scope.row.delay ? "延迟" : ""
                      }}{{ scope.row.open ? "开启" : "关闭" }}
                    </span>
                    <el-switch
                      style="display: block"
                      v-model="scope.row.open"
                      active-color="#13ce66"
                      inactive-color="#ff4949"
                      :active-value="1"
                      :inactive-value="0"
                     
                    >
                    </el-switch>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="effectivetime"
                label="有效时间段"
                align="center"
              >
                <template slot-scope="scope">
                  <span>
                    {{ scope.row.effectivetime[0] }}-{{
                      scope.row.effectivetime[1]
                    }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                prop="airTemperatureset"
                label="空调温度/模式"
                align="center"
              >
                <template slot-scope="scope">
                  <span>
                    {{
                      airTemperatureset(
                        scope.row.airTemperatureset,
                        scope.row.probeType
                      )
                    }}
                    {{ airMode(scope.row.airMode, scope.row.probeType) }}
                  </span>
                </template>
              </el-table-column>

              <el-table-column label="操作" width="150" align="center">
                <template slot-scope="scope">
                  <el-button
                    type="primary"
                    size="small"
                    @click="handleEdit(scope.row, scope.$index, 'edit')"
                    >编辑</el-button
                  >
                  <el-button
                    type="danger"
                    size="small"
                    @click="handleDelete(scope.$index)"
                    >删除</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div
            class="dialog-footer"
            style="text-align: center; margin-top: 20px"
          >
            <el-button type="primary" @click="nextStep('triggerprodScene')"
              >确定</el-button
            >
            <el-button @click="dialogAddSceneVisible = false">取 消</el-button>
          </div>
        </div>
      </el-dialog>
      <el-dialog
        title="添加目标设备"
        :visible.sync="dialogAddTaskprodVisible"
        width="625px"
        class="AddScene-row Taskprod-row"
        :close-on-click-modal="false"
        @close="closeTaskprod"
      >
        <div style="margin-bottom: 10px">
          <span style="color: #fff">目标设备组：</span>
          <el-select
            v-model="AddScene.taskgroupId"
            filterable
            placeholder="请选择目标设备组"
            @change="triggergroupchange(2)"
          >
            <el-option
              v-for="item of SceneGrouplist"
              :key="item.id"
              :label="item.sceneGroupName"
              :value="item.id"
            ></el-option>
          </el-select>
        </div>
        <div class="prodtransfer">
          <el-transfer
            :render-content="renderFunc"
            filterable
            ref="prodtransfer"
            filter-placeholder="请输入设备名称"
            :titles="['未加入设备', '已加入设备']"
            v-model="taskprodId"
            :data="taskprodData"
            :props="prodprops"
          >
          </el-transfer>
        </div>
        <div slot="footer" class="dialog-footer">
          <div class="sub-can-btn-box">
            <el-button @click="submitAddtaskprod" size="medium" type="primary"
              >确 定
            </el-button>
            <el-button size="medium" @click="dialogAddTaskprodVisible = false"
              >取 消
            </el-button>
          </div>
        </div>
      </el-dialog>
      <el-dialog
        :title="
          addtargetProd
            ? '添加目标设备'
            : `设定${editTaskproddata.channelName}状态`
        "
        :visible.sync="dialogTaskprodEditVisible"
        width="620px"
        class="AddScene-row Taskprod-row"
        :close-on-click-modal="false"
      >
        <el-form
          :model="editTaskproddata"
          label-width="100px"
          class="add-taskprod"
        >
          <el-form-item label="设备组" prop="taskgroupId" v-if="addtargetProd">
            <el-select
              v-model="AddScene.taskgroupId"
              filterable
              placeholder="请选择目标设备组"
              @change="triggergroupchange(2)"
            >
              <el-option
                v-for="item of SceneGrouplist"
                :key="item.id"
                :label="item.sceneGroupName"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="目标设备"
            prop="triggerprodId"
            v-if="addtargetProd"
          >
            <el-select
              v-model="AddScene.addtaskprodId"
              placeholder="请选择目标设备"
              @change="taskprodchange()"
            >
              <el-option
                v-for="item of taskprodData"
                :key="item.id"
                :label="item.channelName"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="开关状态" prop="name" v-if="editTaskprodObj">
            <el-switch
              v-model="editTaskproddata.open"
              active-color="#13ce66"
              inactive-color="#ff4949"
              :active-value="1"
              :inactive-value="0"
            >
            </el-switch>
          </el-form-item>
          <el-form-item
            label="执行方式"
            prop="name"
            class="defer_row"
            v-if="editTaskprodObj"
          >
            <el-radio-group v-model="editTaskproddata.delay">
              <el-radio
                :key="item.S"
                :label="item.S"
                v-for="item of defer_Options"
                >{{ item.name }}</el-radio
              >
            </el-radio-group>
            <div v-if="editTaskproddata.delay">
              <span style="margin-right: 10px">延迟</span>
              <el-input
                v-model.number="editTaskproddata.defertime"
                placeholder="请填写延迟时间"
              ></el-input>
              <span>分钟执行</span>
            </div>
          </el-form-item>
          <el-form-item
            label="有效时间段"
            prop="name"
            v-if="editTaskprodObj"
            style="margin-bottom: 5px"
          >
            <el-time-picker
              is-range
              v-model="editTaskproddata.effectivetime"
              value-format="HH:mm"
              format="HH:mm"
              range-separator="至"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              placeholder="选择时间范围"
            >
            </el-time-picker>
          </el-form-item>
          <el-form-item
            label=""
            prop="name"
            v-if="editTaskprodObj"
            style="margin-bottom: 0px"
          >
            <el-checkbox-group
              v-model="editTaskproddata.effectiveweek"
              class="checkbox-row"
            >
              <el-checkbox
                :label="week.id"
                :key="week.id"
                v-for="week of week_Options"
                >{{ week.name }}</el-checkbox
              >
            </el-checkbox-group>
          </el-form-item>
          <el-form-item
            label="空调温度"
            prop="name"
            class="temperature-Form"
            v-if="
              editTaskproddata.isair && editTaskproddata.open && editTaskprodObj
            "
          >
            <el-button
              size="mini"
              icon="el-icon-minus"
              @click="handleTemperatureChange('reduce')"
              round
            ></el-button>
            <span class="temperature-txt"
              >{{ editTaskproddata.airTemperatureset }}℃</span
            >
            <el-button
              size="mini"
              icon="el-icon-plus"
              @click="handleTemperatureChange('add')"
              round
            ></el-button>
          </el-form-item>

          <el-form-item
            label="空调模式"
            class="airitem"
            prop="name"
            v-if="
              editTaskproddata.isair && editTaskproddata.open && editTaskprodObj
            "
          >
            <el-radio-group v-model="editTaskproddata.airMode" size="medium">
              <el-radio-button
                :key="mode.M"
                :label="mode.M"
                v-for="mode of air_modeOptions"
                >{{ mode.name }}</el-radio-button
              >
            </el-radio-group>
          </el-form-item>
          <el-form-item
            label="空调风速"
            class="airitem"
            prop="name"
            v-if="
              editTaskproddata.isair && editTaskproddata.open && editTaskprodObj
            "
          >
            <el-radio-group v-model="editTaskproddata.airSpeed" size="medium">
              <el-radio-button
                :key="speed.W"
                :label="speed.W"
                v-for="speed of air_speedOptions"
                >{{ speed.name }}</el-radio-button
              >
            </el-radio-group>
          </el-form-item>
          <el-form-item
            label="空调风向"
            prop="name"
            class="airitem"
            v-if="
              editTaskproddata.isair && editTaskproddata.open && editTaskprodObj
            "
          >
            <el-radio-group
              v-model="editTaskproddata.airWindDirection"
              size="medium"
            >
              <el-radio-button
                :key="wind.D"
                :label="wind.D"
                v-for="wind of air_directionOptions"
                >{{ wind.name }}</el-radio-button
              >
            </el-radio-group>
          </el-form-item>
        </el-form>
        <div class="dialog-footer" style="text-align: center">
          <el-button
            size="medium"
            type="primary"
            v-if="dialogEditTargetVisible"
            @click="editSceneTarget()"
            >确定</el-button
          >
          <el-button
            size="medium"
            type="primary"
            v-if="!dialogEditTargetVisible"
            @click="dialogTaskprodEditVisible = false"
            >确定</el-button
          >
          <el-button @click="closeTaskprodEdit()">取消</el-button>
        </div>
      </el-dialog>

      <el-dialog
        title="管理触发设备"
        :visible.sync="dialogEditTriggerVisible"
        width="800px"
        class="AddScene-row"
        :close-on-click-modal="false"
      >
        <el-button
          type="primary"
          style="margin-bottom: 0.1rem"
          size="medium"
          plain
          @click="editAddTrigger('add')"
          >添加触发设备</el-button
        >
        <el-collapse v-model="triggercollapse" class="EditTriggerlist-row">
          <el-collapse-item
            title="单条件触发"
            name="1"
            v-if="getSinglrOrMultiplefactorlist(triggerProd, 1).length > 0"
          >
            <el-table
              :data="getSinglrOrMultiplefactorlist(triggerProd, 1)"
              style="width: 100%"
            >
              <el-table-column prop="channelName" label="设备名称">
              </el-table-column>
              <el-table-column prop="triggerAttr" label="触发条件">
                <template slot-scope="scope">
                  <span>{{ protriggertxt(scope.row) }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="channelName" label="操作">
                <template slot-scope="scope">
                  <el-button
                    type="primary"
                    size="small"
                    @click="editAddTrigger('edit', scope.row)"
                    >编辑</el-button
                  >
                  <el-button
                    type="danger"
                    size="small"
                    @click="delSceneTrigger(scope.row.id)"
                    >删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-collapse-item>
          <el-collapse-item
            title="多条件触发"
            name="2"
            v-if="getSinglrOrMultiplefactorlist(triggerProd, 0).length > 0"
          >
            <el-table
              :data="getSinglrOrMultiplefactorlist(triggerProd, 0)"
              style="width: 100%"
            >
              <el-table-column prop="channelName" label="设备名称">
              </el-table-column>
              <el-table-column prop="triggerAttr" label="触发条件">
                <template slot-scope="scope">
                  <span>{{ protriggertxt(scope.row) }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="channelName" label="操作">
                <template slot-scope="scope">
                  <el-button
                    type="primary"
                    size="small"
                    @click="editAddTrigger('edit', scope.row)"
                    >编辑</el-button
                  >
                  <el-button
                    type="danger"
                    size="small"
                    @click="delSceneTrigger(scope.row.id)"
                    >删除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-collapse-item>
        </el-collapse>
      </el-dialog>
      <el-dialog
        title="管理目标设备"
        :visible.sync="dialogEditTargetVisible"
        width="800px"
        class="AddScene-row"
        :close-on-click-modal="false"
      >
        <div>
          <el-button
            type="primary"
            style="margin-bottom: 0.1rem"
            size="medium"
            plain
            @click="handleEdit({}, -1, 'add')"
            >添加目标设备</el-button
          >
          <el-table
            :data="targetProdlist"
            style="width: 100%"
            ref="multipleTable"
          >
            <el-table-column prop="channelName" label="通道名称">
            </el-table-column>
            <el-table-column prop="open" label="开关操作" align="center">
              <template slot-scope="scope">
                <div class="open-row">
                  <span style="margin-right: 0.1rem">
                    {{ scope.row.delay ? "延迟" : ""
                    }}{{ scope.row.open ? "开启" : "关闭" }}
                  </span>
                  <el-switch
                    style="display: block"
                    v-model="scope.row.open"
                    active-color="#13ce66"
                    inactive-color="#ff4949"
                    :active-value="1"
                    :inactive-value="0"
                    @change="handleopenEdit(scope.row, scope.$index)"
                  >
                  </el-switch>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="effectivetime"
              label="有效时间段"
              align="center"
            >
              <template slot-scope="scope">
                <span>
                  {{ scope.row.effectivetime[0] }}-{{
                    scope.row.effectivetime[1]
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column
              prop="airTemperatureset"
              label="空调温度/模式"
              align="center"
            >
              <template slot-scope="scope">
                <span>
                  {{
                    airTemperatureset(
                      scope.row.airTemperatureset,
                      scope.row.probeType
                    )
                  }}
                  {{ airMode(scope.row.airMode, scope.row.probeType) }}
                </span>
              </template>
            </el-table-column>

            <el-table-column label="操作" width="150" align="center">
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  size="small"
                  @click="handleEdit(scope.row, scope.$index, 'edit')"
                  >编辑</el-button
                >
                <el-button
                  type="danger"
                  size="small"
                  @click="delSceneTarget(scope.row.id)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <!-- <div
          slot="footer"
          class="dialog-footer"
          style="text-align: center; margin-top: 20px"
        >
          <el-button type="primary" @click="dialogEditTargetVisible = false">确定</el-button>
          <el-button @click="dialogEditTargetVisible = false">取 消</el-button>
        </div> -->
      </el-dialog>

      <el-dialog
        :title="`${sceneLinkageRecordtitle}场景联动记录`"
        :visible.sync="dialogSceneLinkageRecordVisible"
        width="800px"
        :close-on-click-modal="false"
      >
        <el-table
          :data="sceneLinkageRecorddata"
          style="width: 100%"
          height="300px"
          border
        >
          <el-table-column type="index" label="序号" width="50">
          </el-table-column>
          <el-table-column
            prop="createTime"
            label="触发时间"
            width="200"
            align="center"
          >
            <template slot-scope="scope">
              <span>{{ scope.row.createTime }}</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="triggerChannelName"
            label="最终触发设备"
            align="center"
          >
          </el-table-column>
          <!-- <el-table-column prop="triggerAttr" label="触发条件">
            <template slot-scope="scope">
              <span>{{ protriggertxt(scope.row) }}</span>
            </template>
          </el-table-column> -->
          <el-table-column prop="channelName" label="操作" align="center">
            <template slot-scope="scope">
              <el-button
                type="primary"
                size="small"
                @click="browseVerify(scope.row.verifyCondition)"
                >查看触发条件</el-button
              >
              <el-button
                type="primary"
                size="small"
                @click="browseAction(scope.row.actionDetailList)"
                >查看执行设备
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>
      <el-dialog
        title="触发条件"
        :visible.sync="dialogBrowseVerifyVisible"
        width="800px"
        class="AddScene-row"
        :close-on-click-modal="false"
      >
        <el-table :data="browseVerifyData" style="width: 100%" border>
          <el-table-column type="index" label="序号" width="50">
          </el-table-column>
          <el-table-column prop="channelName" label="设备名称" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.sceneAction.channelName }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="channelName" label="触发要求">
            <template slot-scope="scope">
              <span>{{
                scope.row.sceneAction.singleton == 1
                  ? "单条件满足"
                  : "多条件满足"
              }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="triggerAttr" label="触发条件">
            <template slot-scope="scope">
              <span>{{ protriggertxt(scope.row.sceneAction) }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="triggerAttr" label="设备上报值">
            <template slot-scope="scope">
              <span>{{ prostatustxt(scope.row) }}</span>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>
      <el-dialog
        title="对应触发设备"
        :visible.sync="dialogBrowseActionVisible"
        width="800px"
        class="AddScene-row"
        :close-on-click-modal="false"
      >
        <div>
          <el-table
            :data="browseActionData"
            style="width: 100%"
            ref="multipleTable"
            border
          >
            <el-table-column type="index" label="序号" width="50">
            </el-table-column>
            <el-table-column prop="channelName" label="通道名称" align="center">
            </el-table-column>
            <el-table-column prop="open" label="开关操作" align="center">
              <template slot-scope="scope">
                <span>
                  {{ scope.row.open ? "开启" : "关闭" }}
                </span>
              </template>
            </el-table-column>
            <el-table-column
              prop="effectivetime"
              label="有效时间段"
              align="center"
            >
              <template slot-scope="scope">
                <span>
                  {{ scope.row.effectivetime[0] }}-{{
                    scope.row.effectivetime[1]
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column
              prop="airTemperatureset"
              label="空调温度/模式"
              align="center"
            >
              <template slot-scope="scope">
                <span>
                  {{
                    airTemperatureset(
                      scope.row.airTemperatureset,
                      scope.row.probeType
                    )
                  }}
                  {{ airMode(scope.row.airMode, scope.row.probeType) }}
                </span>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-dialog>
    </div>
  </div>
</template>
<script src="./index.js"></script>
<style lang="stylus" src="./index.styl" scoped></style>